package com.sunwayhorizo.health.hl7.rim;

import com.sunwayhorizo.health.common.*;
import com.sunwayhorizo.health.hl7.common.*;
import com.sunwayhorizo.health.hl7.datatypes.*;
import com.sunwayhorizo.health.hl7.factories.*;
import java.io.*;
import java.sql.*;
import javax.persistence.*;
import org.jboss.seam.annotations.*;

@Name("ManufacturedMaterial")
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("MMAT")
public class ManufacturedMaterial extends Material implements Serializable
{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;


    /*
     * public IVL_TS expirationTime; 
     * public ST LotNumberText; 
     * public IVL_TS StabilityTime;
     */
    public ManufacturedMaterial() throws Hl7Exception
    {
    }


    public ManufacturedMaterial(ReferenceModifier referencemodifier)
    {
        super(referencemodifier);
    }


    public void setExpirationTime(IVL_TS expirationTime)
    {
        this.setMmExpStartDateTs(new Timestamp(expirationTime.low().toDate().getTime()));
        this.setMmExpEndDateTs(new Timestamp(expirationTime.high().toDate().getTime()));
        this.setMmExpDateTxt(expirationTime.literal().toString());
        PQ pq = (PQ) expirationTime.width();
        this.setMmExpDateIvlTxt(pq.value().literal().toString());
        this.setMmExpDateIvlUomCode(pq.unit().code().toString());
    }


    public IVL_TS getExpirationTime() throws Hl7Exception
    {
        return DataTypeUtil.getIVL_TS(this.getMmExpStartDateTs(), this.getMmExpEndDateTs(), this.getMmExpDateIvlTxt(), this.getMmExpDateIvlUomCode(),
            null);
    }


    public void setLotNumberText(ST LotNumberText)
    {
        if(LotNumberText == null || LotNumberText.isNull().isTrue()) return;
        this.setMmLotnumberTxt(LotNumberText.toString());
    }


    public ST getLotNumberText() throws Hl7Exception
    {
        return DataTypeUtil.getST(this.getMmLotnumberTxt());
    }


    public void setStabilityTime(IVL_TS StabilityTime)
    {
        this.setMmStabilityStartDateTs(new Timestamp(StabilityTime.low().toDate().getTime()));
        this.setMmStabilityEndDateTs(new Timestamp(StabilityTime.high().toDate().getTime()));
        this.setMmStabilityDateTxt(StabilityTime.literal().toString());
        PQ pq = (PQ) StabilityTime.width();
        this.setMmStabilityDateIvlTxt(pq.value().literal().toString());
        this.setMmStabilityDateIvlUomCode(pq.unit().code().toString());
    }


    public IVL_TS getStabilityTime() throws Hl7Exception
    {
        return DataTypeUtil.getIVL_TS(this.getMmStabilityStartDateTs(), this.getMmStabilityEndDateTs(), this.getMmStabilityDateIvlTxt(),
            this.getMmStabilityDateIvlUomCode(), null);
    }

    // ManufacturedMaterial������
    @Column(name = "MM_LOTNUMBER_TXT")
    private String mmLotnumberTxt;
    @Column(name = "MM_EXP_START_DATE_TS")
    private Timestamp mmExpStartDateTs;
    @Column(name = "MM_EXP_END_DATE_TS")
    private Timestamp mmExpEndDateTs;
    @Column(name = "MM_EXP_DATE_TXT")
    private String mmExpDateTxt;
    @Column(name = "MM_EXP_DATE_IVL_TXT")
    private String mmExpDateIvlTxt;
    @Column(name = "MM_EXP_DATE_IVL_UOM_CODE")
    private String mmExpDateIvlUomCode;
    @Column(name = "MM_STABILITY_START_DATE_TS")
    private Timestamp mmStabilityStartDateTs;
    @Column(name = "MM_STABILITY_END_DATE_TS")
    private Timestamp mmStabilityEndDateTs;
    @Column(name = "MM_STABILITY_DATE_TXT")
    private String mmStabilityDateTxt;
    @Column(name = "MM_STABILITY_DATE_IVL_TXT")
    private String mmStabilityDateIvlTxt;
    @Column(name = "MM_STABILITY_DATE_IVL_UOM_CODE")
    private String mmStabilityDateIvlUomCode;


    private void setMmLotnumberTxt(String mmLotnumberTxt)
    {
        this.mmLotnumberTxt = mmLotnumberTxt;
    }


    private String getMmLotnumberTxt()
    {
        return mmLotnumberTxt;
    }


    private void setMmExpStartDateTs(Timestamp mmExpStartDateTs)
    {
        this.mmExpStartDateTs = mmExpStartDateTs;
    }


    private Timestamp getMmExpStartDateTs()
    {
        return mmExpStartDateTs;
    }


    private void setMmExpEndDateTs(Timestamp mmExpEndDateTs)
    {
        this.mmExpEndDateTs = mmExpEndDateTs;
    }


    private Timestamp getMmExpEndDateTs()
    {
        return mmExpEndDateTs;
    }


    private void setMmExpDateTxt(String mmExpDateTxt)
    {
        this.mmExpDateTxt = mmExpDateTxt;
    }


    @SuppressWarnings("unused")
    private String getMmExpDateTxt()
    {
        return mmExpDateTxt;
    }


    private void setMmExpDateIvlTxt(String mmExpDateIvlTxt)
    {
        this.mmExpDateIvlTxt = mmExpDateIvlTxt;
    }


    private String getMmExpDateIvlTxt()
    {
        return mmExpDateIvlTxt;
    }


    private void setMmExpDateIvlUomCode(String mmExpDateIvlUomCode)
    {
        this.mmExpDateIvlUomCode = mmExpDateIvlUomCode;
    }


    private String getMmExpDateIvlUomCode()
    {
        return mmExpDateIvlUomCode;
    }


    private void setMmStabilityStartDateTs(Timestamp mmStabilityStartDateTs)
    {
        this.mmStabilityStartDateTs = mmStabilityStartDateTs;
    }


    private Timestamp getMmStabilityStartDateTs()
    {
        return mmStabilityStartDateTs;
    }


    private void setMmStabilityEndDateTs(Timestamp mmStabilityEndDateTs)
    {
        this.mmStabilityEndDateTs = mmStabilityEndDateTs;
    }


    private Timestamp getMmStabilityEndDateTs()
    {
        return mmStabilityEndDateTs;
    }


    private void setMmStabilityDateTxt(String mmStabilityDateTxt)
    {
        this.mmStabilityDateTxt = mmStabilityDateTxt;
    }


    @SuppressWarnings("unused")
    private String getMmStabilityDateTxt()
    {
        return mmStabilityDateTxt;
    }


    private void setMmStabilityDateIvlTxt(String mmStabilityDateIvlTxt)
    {
        this.mmStabilityDateIvlTxt = mmStabilityDateIvlTxt;
    }


    private String getMmStabilityDateIvlTxt()
    {
        return mmStabilityDateIvlTxt;
    }


    private void setMmStabilityDateIvlUomCode(String mmStabilityDateIvlUomCode)
    {
        this.mmStabilityDateIvlUomCode = mmStabilityDateIvlUomCode;
    }


    private String getMmStabilityDateIvlUomCode()
    {
        return mmStabilityDateIvlUomCode;
    }

}
